﻿@model HelloMinasan.Domain.Song

<link href="@Url.Content("~/Scripts/cleditor/jquery.cleditor.css")" rel="stylesheet" type="text/css" /> 
<script src="@Url.Content("~/Scripts/cleditor/jquery.cleditor.min.js")" type="text/javascript"></script> 
<script src="@Url.Content("~/Scripts/cleditor/jquery.cleditor.xhtml.min.js")" type="text/javascript"></script> 

@{
    ViewBag.Title = "Create";
}

<script type="text/javascript">
 
    $(document).ready(function () {
        var options = {
            width: 955,
            height: 400
    };
 
    var editor = $("#editor").cleditor(options)[0];
 
    $("#btnClear").click(function (e) {
        e.preventDefault();
        editor.focus();
        editor.clear();
    });
 
    $("#btnAddImage").click(function () {
        editor.execCommand("insertimage",
            "http://images.free-extras.com/pics/s/smile-1620.JPG", null, null);
        editor.focus();
    });
    //cái này nó show được html rồi, giờ muốn lấy để đưa qua Controllers để save xuống db
    $("#btnGetHtml").click(function () {
        alert($("#editor").val());
    });


    });
</script>
 


<body>
<div style="width: 400px">
    <div>
        <textarea id="editor" rows="0" cols="0">@Model.Grammar</textarea>
    </div>
    <div style="float: right">
        <a href="#" class="siteButton" id="btnClear">Clear</a>
        <a href="#" class="siteButton" id="btnAddImage">Add an image</a>
        <a href="#" class="siteButton" id="btnGetHtml">Get html</a>
        <a href="#" class="siteButton" id="btlong">Copy(test thử)</a>
        <a> </a>
    </div>
</div>
</body>


@* phần dưới này tao test thử button thôi *@
<div> </div>
<a href="#" onclick="javascript:OnCriteria1(1, false);">Save</a>

<script type="text/javascript">
    function OnCriteria1(page, includeNewCriteria) {

        $.ajax(
          {
              type: "GET",
              url: "/QA/Index",
              success: function (result) {
                  $("#PersonContainer").html(result.toString());
              },
              error: function () {
                  alert("Searching failed!");
              }
          });
    }
</script>